<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>15-复选组件</title>
    <!--Vue必须放上面-->
    <script src="../js/vue.js"></script>
    <!--ElementUi-->
    <script src="../element-ui/lib/index.js"></script>
    <link rel="stylesheet" href="../element-ui/lib/theme-chalk/index.css">
</head>
<body>
    <div id="app">
        <!--
            复选组件： el-checkbox-group > el-checkbox     块级组件
               el-checkbox : 复选组件的选项
                 label : 类似传统的value

              注意： 复选组件绑定的属性是数组
        -->
        <!--以前的复选框VS现在的复选框-->
        <input type="checkbox" name="hobby" value="1" checked>唱歌
        <input type="checkbox" name="hobby" value="2">跳舞
        <input type="checkbox" name="hobby" value="3">rap
        <input type="checkbox" name="hobby" value="4" checked>篮球
        <hr>
        <el-checkbox-group v-model="hobby">
            <el-checkbox label="1">唱歌</el-checkbox>
            <el-checkbox label="2">跳舞</el-checkbox>
            <el-checkbox label="3">rap</el-checkbox>
            <el-checkbox label="4">篮球</el-checkbox>
        </el-checkbox-group>
        <el-checkbox-group v-model="hobby">
            <el-checkbox label="1">唱歌</el-checkbox>
            <el-checkbox label="2">跳舞</el-checkbox>
            <el-checkbox label="3">rap</el-checkbox>
            <el-checkbox label="4">篮球</el-checkbox>
        </el-checkbox-group>
    </div>
    <script>
        const vm = new Vue({
            el: "#app",
            data: {
                hobby:["1","4"],
            },
            methods: {
            },
            watch:{
                hobby:function (newValue,oldValue){
                    console.log(`新值：${newValue} , 旧值：${oldValue}`);
                }
            }
        });
    </script>
</body>
</html>